<html>
    <head>
        <title>Xmpp4Js Sample Client</title>
			<script type="text/javascript" src="lib/log4js.js"></script>
            <script type="text/javascript" src="lib/prototype.js"></script> 
            <script type="text/javascript" src="lib/dom-all.js"></script>
            <script type="text/javascript" src="lib/crypto.js"></script>
            <script type="text/javascript" src="lib/xmpp4js.js"></script>
			<script type="text/javascript" src="lib/rpc4xmpp.js"></script>
			<script type="text/javascript" src="lib/xmpp4gg.js"></script>
  
    </head>
    
	<body>
	<form id="form_add" name="form_add">
                <dl>
                    <dt>Varijabla a:</dt>
                    <dd>
                        <input type="text" id="a" size="10" value="2"/>
                    </dd>
					<dt>Varijabla b:</dt>
                    <dd>
                        <input type="text" id="b" size="10" value="4"/>
                    </dd>
					<dt>Rezultat:</dt>
                    <dd>
                        <input type="text" id="c" size="10" />
                    </dd>
                    <input type="button" value="Zbroji" size="30" onclick="Add(a.value,b.value);"/>
                </dl>
    </form>
    </body>
        
    <script type="text/javascript">
	function Add(var1,var2) {
	    a = parseInt(var1);
		b = parseInt(var2);
		//c = a + b;
		//xmpp.sendMessage("vedran@161.53.65.135", c);
		//document.form_add.c.value = c;
		rpcxmpp.call({destination : window.parent.frames[1], method: "Add", params: [a, b], destinationDomain : "admin@161.53.65.135/service_add", 
          onSuccess : function(returnObj){document.form_add.c.value = returnObj.returnValue; alert(returnObj.returnValue);},
          onError : function(statusObj){alert("ne radi!");}});      
        
		
	};
				
	
	window.onload = function() {
	    client.login("vedran", "testa", "161.53.65.135", "user_add", "http://161.53.65.135:7070/http-bind/", false);		
	};

	window.onunload = function() {
		client.close();
	}
	</script>
            
    </body>
</html>